package com.junzhiit.nengji.dao.util;

import com.bainaeco.framework.common.jedis.RedisKey;

/**
 * DIY Key Cenerator format is: type + delimiter + DIY Key + delimiter + [id]
 * Example: List + : + MyKey + : + [001] -> List:MyKey:001 PS: [id] is select.
 * 
 * @author Joe
 */
public class DIYKey {

	private final static String STRING_KEY_PREFIX = RedisKey.STRING_PREFIX + RedisKey.DELIMITER;

	private final static String HASH_KEY_PREFIX = RedisKey.HASH_PREFIX + RedisKey.DELIMITER;

	private final static String SET_KEY_PREFIX = RedisKey.SET_PREFIX + RedisKey.DELIMITER;

	private final static String ZSET_KEY_PREFIX = RedisKey.ZSET_PREFIX + RedisKey.DELIMITER;

	private final static String LIST_KEY_PREFIX = RedisKey.LIST_PREFIX + RedisKey.DELIMITER;

	private final static String SORTED_SET_KEY_PREFIX = RedisKey.SORTED_SET_PREFIX + RedisKey.DELIMITER;

	private final static String QUEUE_KEY_PREFIX = RedisKey.QUEUE_PREFIX + RedisKey.DELIMITER;

	public static String getSessionHashKey(String sessionId) {
		return new StringBuilder().append(HASH_KEY_PREFIX).append("Session").append(RedisKey.DELIMITER)
				.append(sessionId).toString();
	}

	public static String getUserSessionHashKey(String sessionId) {
		return new StringBuilder().append(HASH_KEY_PREFIX).append("UserSession").append(RedisKey.DELIMITER)
				.append(sessionId).toString();
	}

	public static String getMobilePhoneCodeKey(String mobilePhone) {
		return new StringBuilder().append(HASH_KEY_PREFIX).append("MobilePhoneCode").append(RedisKey.DELIMITER)
				.append(mobilePhone).toString();
	}
	
	public static String getPostageTemplateAreaKey(String postageTemplateId) {
		return new StringBuilder().append(HASH_KEY_PREFIX).append("PostageTemplateArea").append(RedisKey.DELIMITER)
				.append(postageTemplateId).toString();
	}
	
	public static String getPostageTemplateAreaKey() {
		return new StringBuilder().append(STRING_KEY_PREFIX).append("PostageTemplateArea").toString();
	}
	
	public static String getGoodsHistoryKey(String date) {
		return new StringBuilder().append(STRING_KEY_PREFIX).append("GoodsHistory").append(RedisKey.DELIMITER)
				.append(date).toString();
	}
	
	public static String getQuestionKey(String date) {
		return new StringBuilder().append(STRING_KEY_PREFIX).append("Question").append(RedisKey.DELIMITER)
				.append(date).toString();
	}

	public static String getEmailCodeKey(String email) {
		return new StringBuilder().append(HASH_KEY_PREFIX).append("Email").append(RedisKey.DELIMITER).append(email)
				.toString();
	}

	public static String getRoleCodeStringKey() {
		return new StringBuilder().append(STRING_KEY_PREFIX).append("RoleCode").toString();
	}

	public static String getFunctionCodeStringKey() {
		return new StringBuilder().append(STRING_KEY_PREFIX).append("FunctionCode").toString();
	}

	public static String getBrandCodeStringKey() {
		return new StringBuilder().append(STRING_KEY_PREFIX).append("BrandCode").toString();
	}
	
	public static String getChainBrandCodeStringKey() {
		return new StringBuilder().append(STRING_KEY_PREFIX).append("ChainBrandCode").toString();
	}

	public static String getAdvertiseTypeCodeStringKey() {
		return new StringBuilder().append(STRING_KEY_PREFIX).append("AdvertiseTypeCode").toString();
	}

	public static String getWhiteListPhoneKey(String systemId) {
		return new StringBuilder().append(LIST_KEY_PREFIX).append("WhiteListPhone").append(RedisKey.DELIMITER)
				.append(systemId).toString();
	}

	public static String getFunctionStringKey(String sessionId) {
		return new StringBuilder().append(STRING_KEY_PREFIX).append("Function").append(RedisKey.DELIMITER)
				.append(sessionId).toString();
	}
	
	
	public static String getMemberCodeStringKey(){
		return new StringBuilder().append(STRING_KEY_PREFIX)
				.append("NewUserCode").toString();
	}
	
	public static String getWechatCodeStringKey(){
		return new StringBuilder().append(STRING_KEY_PREFIX)
				.append("NewWechatCode").toString();
	}
	
	public static String getRebateStringKey(String rebateCategoryId){
		return new StringBuilder().append(STRING_KEY_PREFIX).append("UserRebateCode").append(RedisKey.DELIMITER)
				.append(rebateCategoryId).toString();
	}
	
	public static String getShopCodeStringKey(){
		return new StringBuilder().append(STRING_KEY_PREFIX)
				.append("NewShopCode").toString();
	}
	
	public static String getBankCardCheckCount(String id){
		return new StringBuilder().append(STRING_KEY_PREFIX).append("BankCardCheckCount").append(RedisKey.DELIMITER)
				.append(id).toString();
	}
	
	public static String getFormIdByOrderNumber(String orderNumber) {
		return new StringBuilder().append(HASH_KEY_PREFIX).append("UserFormId").append(RedisKey.DELIMITER).append(orderNumber)
				.toString();
	}
	
	public static String getCouponsCheckCount(String userId) {
		return new StringBuilder().append(STRING_KEY_PREFIX).append("CouponsCheckCount").append(RedisKey.DELIMITER)
				.append(userId).toString();
	}
	
	public static String getWechatCodeKey(String code) {
		return new StringBuilder().append(HASH_KEY_PREFIX).append("wcId").append(RedisKey.DELIMITER).append(code)
				.toString();
	}
	
	public static String getReservedKey(String cdId) {
		return new StringBuilder().append(HASH_KEY_PREFIX).append("Reserved").append(RedisKey.DELIMITER).append(cdId)
				.toString();
	}
	
	public static String getPrinterAccessTokenKey() {
		return new StringBuilder().append(HASH_KEY_PREFIX).append("Printer").append(RedisKey.DELIMITER).append("AccessToken").toString();
	}
	
	public static String getDailyOrderNumber() {
		return new StringBuilder().append(STRING_KEY_PREFIX).append("Printing").append(RedisKey.DELIMITER).append("DailyOrderNumber").toString();
	}
}
